<h2><?php pc_echo(pc_message("order.title")); ?></h2>
<?php pc_pagelet("common/errors"); 
$errors = pc_variable("errors");
$order = pc_variable("commerce.order"); 
if($order !== null && $order->get("orderItems")->size() > 0) { ?>
<form method="post" action="dispatcher.php">
    <fieldset>
        <table class="order">
            <thead>
                <tr>
                    <th></th>
                    <th><?php pc_echo(pc_message("order.quantity")); ?></th>
                    <th class="description"><?php pc_echo(pc_message("order.article")); ?></th>
                    <th><?php pc_echo(pc_message("order.price")); ?></th>
                    <th><?php pc_echo(pc_message("order.value")); ?></th>
                </tr>
            </thead>
            <tbody>
                <?php
                foreach($order->get("orderItems") as $index => $orderItem) { 
                    pc_pagelet("order/item",
                            array(
                                "index" => $index,
                                "commerce.orderItem" => $orderItem
                            ));
                } ?>
                <tr class="total">
                    <td></td>
                    <td><?php pc_echo($order->getTotalQuantity()); ?></td>
                    <td colspan="2"><strong><?php pc_echo(pc_message("order.total")); ?></strong></td>
                    <td class="money"><?php pc_echo($order->getCurrency()->getSymbol() . " " . pc_format_number($order->getTotalAmount(), "0.00")); ?></td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <div class="buttons">
        <input type="hidden" name="targetPage.location" value="<?php pc_echo(pc_variable("targetPage.location")); ?>"/>
        <button type="submit" name="controller" value="Commerce/UpdateOrderQuantities" class="save-changes"><?php pc_echo(pc_message("order.saveChanges")); ?></button>
        <button type="submit" name="controller" value="Commerce/RemoveItemsFromOrder" class="remove-from-order"><?php pc_echo(pc_message("order.removeItems")); ?></button>
    </div>
    <p>
        <?php $targetPageLocation = pc_variable("targetPage.location"); ?>
        <a href="dispatcher.php?controller=Commerce/Authenticated/CheckOut<?php if($targetPageLocation !== null) { pc_echo("&targetPage.location=" . pc_encode_url($targetPageLocation)); }?>" class="checkout"><?php pc_echo(pc_message("order.checkout")); ?></a>
    </p>
</form>
<?php } else { ?>
<p><?php pc_echo(pc_message("order.empty")); ?></p>
<?php } ?>